package alibaba.threadlocal.demo01;

/**
 * @author ChangLiang
 * @date 2020/4/20
 */
public class ProcessThread extends Thread{
    User user;

    ProcessThread(User user) {
        super.setName("ProcessThread-"+user.getName());
        this.user = user;
    }

    @Override
    public void run() {
        try (UserContext ctx = new UserContext(user)) {
            // step 1:
            new Greeting().hello();
            // step 2:
            Level.checkLevel();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
